using MicroMsg.Resource.@string;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using Microsoft.Phone.Tasks;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Media;
namespace MicroMsg.UI.UserContrl
{
	public class SeePrivacyCtrl : UserControl
	{
		public CheckBox cBoxAcceptPcy;
		public TextBlock txtAcceptPcy;
		public Button btnSeePcy;
		public static DependencyProperty mIsCheckedProperty = DependencyProperty.Register("mIsChecked", typeof(bool), typeof(SeePrivacyCtrl), new PropertyMetadata(true));
		public static DependencyProperty mStrPcyLinkProperty = DependencyProperty.Register("mStrPcyLink", typeof(string), typeof(SeePrivacyCtrl), new PropertyMetadata(strings.Login_Main_LinkAgmt));
		internal Grid LayoutRoot;
		internal Paragraph paraContents;
		private bool _contentLoaded;
		public event RoutedEventHandler mEventCBoxChanged;
		public bool mIsChecked
		{
			get
			{
				return this.cBoxAcceptPcy.get_IsChecked().get_Value();
			}
			set
			{
				this.cBoxAcceptPcy.set_IsChecked(new bool?(value));
			}
		}
		public string mStrPcyLink
		{
			get
			{
				return (string)base.GetValue(SeePrivacyCtrl.mStrPcyLinkProperty);
			}
			set
			{
				base.SetValue(SeePrivacyCtrl.mStrPcyLinkProperty, value);
			}
		}
		public SeePrivacyCtrl()
		{
			this.InitializeComponent();
			this.initUI();
		}
		private void initUI()
		{
			this.cBoxAcceptPcy = new CheckBox();
			this.cBoxAcceptPcy.add_Click(new RoutedEventHandler(this.cBoxAcceptPcy_Click));
			this.cBoxAcceptPcy.set_IsChecked(new bool?(true));
			this.cBoxAcceptPcy.set_VerticalAlignment(2);
			this.cBoxAcceptPcy.set_Padding(new Thickness(0.0));
			this.cBoxAcceptPcy.set_Margin(new Thickness(-12.0, 0.0, -12.0, -25.0));
			Run run = new Run();
			run.set_Text(strings.Login_Main_TxtReadAgmt);
			run.set_FontSize(20.0);
			this.btnSeePcy = new Button();
			this.btnSeePcy.set_Padding(new Thickness(0.0));
			this.btnSeePcy.add_Click(new RoutedEventHandler(SeePrivacyCtrl.btnSeePcy_Click));
			this.btnSeePcy.set_Style(MMTheme.GetInstance().ButtonTransparentBkStyle);
			this.btnSeePcy.set_Content(strings.Login_Main_BtnReadAgmt);
			this.btnSeePcy.set_Margin(new Thickness(0.0, 0.0, 0.0, -5.0));
			this.btnSeePcy.set_FontSize(20.0);
			this.btnSeePcy.set_Foreground(MMTheme.GetInstance().COMMON_BRUSH);
			PresentationFrameworkCollection<Inline> arg_187_0 = this.paraContents.get_Inlines();
			InlineUIContainer inlineUIContainer = new InlineUIContainer();
			inlineUIContainer.set_Child(this.cBoxAcceptPcy);
			arg_187_0.Add(inlineUIContainer);
			this.paraContents.get_Inlines().Add(run);
			PresentationFrameworkCollection<Inline> arg_1BB_0 = this.paraContents.get_Inlines();
			InlineUIContainer inlineUIContainer2 = new InlineUIContainer();
			inlineUIContainer2.set_Child(this.btnSeePcy);
			arg_1BB_0.Add(inlineUIContainer2);
		}
		private void cBoxAcceptPcy_Click(object sender, RoutedEventArgs e)
		{
			if (this.mEventCBoxChanged != null)
			{
				this.mEventCBoxChanged.Invoke(sender, e);
			}
		}
		private static void btnSeePcy_Click(object sender, RoutedEventArgs e)
		{
			if (BasePage.CanDoBackSysTask())
			{
				BasePage.DoBackSysTask();
				WebBrowserTask webBrowserTask = new WebBrowserTask();
				webBrowserTask.set_Uri(new Uri(strings.Login_Main_LinkAgmt));
				webBrowserTask.Show();
				return;
			}
		}
		public static Button GetPrivacyButton()
		{
			Button button = new Button();
			button.set_Padding(new Thickness(0.0));
			button.add_Click(new RoutedEventHandler(SeePrivacyCtrl.btnSeePcy_Click));
			button.set_Style(MMTheme.GetInstance().ButtonTransparentBkStyle);
			button.set_Content(strings.Login_Main_BtnReadAgmt);
			button.set_Margin(new Thickness(0.0, 0.0, 0.0, -5.0));
			button.set_FontSize(20.0);
			button.set_Foreground(MMTheme.GetInstance().COMMON_BRUSH);
			return button;
		}
		public static Hyperlink GetPrivacyLinkButton(Brush brush = null)
		{
			Hyperlink hyperlink = new Hyperlink();
			Run run = new Run();
			run.set_Text(strings.Login_Main_BtnReadAgmt);
			if (brush == null)
			{
				run.set_Foreground(R.theme.DIALOG_TITLE_FONT_BRUSH);
			}
			else
			{
				run.set_Foreground(brush);
			}
			hyperlink.get_Inlines().Add(run);
			hyperlink.add_Click(new RoutedEventHandler(SeePrivacyCtrl.btnSeePcy_Click));
			return hyperlink;
		}
		public static Hyperlink GetMicrosoftPrivacyLink(Brush forground = null)
		{
			Hyperlink hyperlink = new Hyperlink();
			Run run = new Run();
			run.set_Text(strings.Lbs_PeoList_MsgPrivacy);
			if (forground != null)
			{
				run.set_Foreground(R.theme.DIALOG_TITLE_FONT_BRUSH);
			}
			hyperlink.get_Inlines().Add(run);
			hyperlink.add_Click(new RoutedEventHandler(SeePrivacyCtrl.hl_Click));
			return hyperlink;
		}
		public static void hl_Click(object sender, RoutedEventArgs e)
		{
			string strUrl;
			if (R.isChineseCN())
			{
				strUrl = "http://www.microsoft.com/windowsphone/zh-cn/privacy.aspx";
			}
			else
			{
				strUrl = "http://www.microsoft.com/windowsphone/en-us/privacy.aspx";
			}
			ToolFunction.GotoWebLink(strUrl);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/CommonUseControl/SeePrivacyCtrl.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.paraContents = (Paragraph)base.FindName("paraContents");
		}
	}
}
